package com.eqgis.eqtool.animation;

import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.view.View;

public class ViewAnimation {
    public static View viewExpandClick(View view, long duration){
        ObjectAnimator translationX = ObjectAnimator.ofFloat(
                view, "scaleX", 1,1.5f,1);
        ObjectAnimator translationY = ObjectAnimator.ofFloat(
                view, "scaleY", 1,1.5f,1);
        AnimatorSet animatorSet=new AnimatorSet();
        animatorSet.setDuration(duration);
        animatorSet.playTogether(translationX, translationY);
        animatorSet.start();
        return view;
    }
    public static View viewUp(View view, long duration){
        ObjectAnimator translationX = ObjectAnimator.ofFloat(
                view, "scaleX", 0,1.5f,1);
        ObjectAnimator translationY = ObjectAnimator.ofFloat(
                view, "scaleY", 0,1.5f,1);
        AnimatorSet animatorSet=new AnimatorSet();
        animatorSet.setDuration(duration);
        animatorSet.playTogether(translationX, translationY);
        animatorSet.start();
        return view;
    }
    public static void viewMove(View view, float v1,float v2){
        ObjectAnimator translationY = ObjectAnimator.ofFloat(
                view, "scaleX", v1, v2);
        ObjectAnimator alpha = ObjectAnimator.ofFloat(view, "alpha", 0, 1);
        AnimatorSet animatorSet=new AnimatorSet();
        animatorSet.setDuration(200);
        animatorSet.playTogether(translationY, alpha);
        animatorSet.start();
    }
}
